﻿using System;
using System.Web;
using System.Xml;
using SyCODE.Component;
using SyCODE.Component.DataFactory;
using System.Data.Common;
using System.Collections.Specialized;
using SyCODE.Component.Cryptography;
using SyCODE.Component.Security;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using System.Text;

namespace SyCODE.Blog.Admin
{
    /// <summary>
    /// DeleteUsers.aspx 的处理程序
    /// </summary>
    public class DeleteUsers : HandlerBase
    {
        public override void ProcessRequest(HttpContext context)
        {
            if (this.Authenticated)
            {
                DBAM dbam = new DBAM();
                dbam.BuildParameters("deleteusers", context.Request.Form);

                DbDataReader dr = dbam.ExecuteReader();

                while (dr.Read())
                {
                    SearchEngine.Simple.Delete(dr.GetInt64(0).ToString());
                }
                dr.NextResult();
                while (dr.Read())
                {
                    try
                    {
                        Directory.Delete(AppPath.GetUserPhysicalPath(dr.GetString(0)), true);
                    }
                    catch
                    {
                    }
                }
            }
        }
    }
}
